package viewPackage.menus;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.event.MouseEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

import mainPackage.GFrame;

public class OptionsPanel extends JPanel {
	
	private GFrame gameFrame;
	
	
	public OptionsPanel(GFrame mainFrame) {
		super();
		gameFrame = mainFrame;
		this.setBackground(Color.BLACK);	
		
		MenuLabel optionsTitle = new MenuLabel("Options", 48);
		MenuLabel keyboard = new MenuLabel("Keyboard Configuration", 20);
		MenuLabel video = new MenuLabel ("Video Configuration", 20);
		MenuLabel sound = new MenuLabel ("Sound Configuration", 20);
		MenuLabel gameplay = new MenuLabel ("Gameplay Configuration", 20);
		MenuLabel backToMainMenu = new MenuLabel ("Back to Main Menu", 20);
		
		keyboard.addMouseListener(new JLabelMouse(keyboard) {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				gameFrame.getContentPane().removeAll();
				gameFrame.getContentPane().add(new KeyboardMenu(gameFrame), BorderLayout.CENTER);
				gameFrame.validate();
				gameFrame.repaint();
				
			}});
		video.addMouseListener(new JLabelMouse(video) {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				gameFrame.getContentPane().removeAll();
				gameFrame.getContentPane().add(new VideoMenu(gameFrame), BorderLayout.CENTER);
				gameFrame.validate();
				gameFrame.repaint();
				
			}});
		sound.addMouseListener(new JLabelMouse(sound) {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				gameFrame.getContentPane().removeAll();
				gameFrame.getContentPane().add(new SoundMenu(gameFrame), BorderLayout.CENTER);
				gameFrame.validate();
				gameFrame.repaint();
				
			}});
		gameplay.addMouseListener(new JLabelMouse(gameplay) {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				gameFrame.getContentPane().removeAll();
				gameFrame.getContentPane().add(new GameplayMenu(gameFrame), BorderLayout.CENTER);
				gameFrame.validate();
				gameFrame.repaint();
				
			}});
		

		backToMainMenu.addMouseListener(new JLabelMouse(backToMainMenu){
			@Override
			public void mouseClicked(MouseEvent arg0) {
				gameFrame.getContentPane().removeAll();
				gameFrame.getContentPane().add(new MainMenuPanel(gameFrame), BorderLayout.CENTER);
				gameFrame.validate();
				gameFrame.repaint();
				
		}});
		
		
		
		GridBagLayout gbl = new GridBagLayout();
		this.setLayout(gbl);
		
		Constraints Ctitle = new Constraints(0,0,1,1,true);
		Constraints Ckeyboard = new Constraints(0,1,1,1,false);
		Constraints Cvideo = new Constraints(0,2,1,1,false);
		Constraints Csound = new Constraints(0,3,1,1,false);
		Constraints Cgameplay = new Constraints(0,4,1,1,false);
		Constraints CBacktoMainMenu	= new Constraints(0, 5, 1, 1, false);
						
		this.add(optionsTitle, Ctitle);
		this.add(keyboard, Ckeyboard);
		this.add(video, Cvideo);
		//this.add(sound, Csound);
		//this.add(gameplay, Cgameplay);
		this.add(backToMainMenu, CBacktoMainMenu);
		
	}
	
}